<template lang="pug">
  .ChooseCustomerModal
    Modal(
      v-model="isShowChooseCustomerModal"
      title="选择单位"
      class-name="vertical-center-modal"
      width="700"
    )
      Transfer.default-transfer(
        :data="customer"
        :target-keys="targetKeys"
        :list-style="listStyle"
        :titles="titles"
        filterable
        @on-change="handleChange"
      )
      .clearfix(slot="footer")
        Button(type="text" @click="cancel") 取消
        Button(type="primary" @click="handleSubmit") 确定
</template>

<script>
import { Common } from '@/utils/common.js'
import { EnumApi } from '@/api/Enum.api'
export default {
  name: 'ChooseCustomerModal',

  watch: {
  },

  data () {
    return {
      isShowChooseCustomerModal: false,
      customer: [],
      targetKeys: [],
      titles: ['待选客户名称', '已选客户名称'],
      listStyle: {
        width: '270px',
        height: '300px'
      }
    }
  },

  mounted () {
  },

  methods: {
    cancel () {
      this.isShowChooseCustomerModal = false
    },

    show () {
      this.isShowChooseCustomerModal = true
    },

    handleChange (newTargetKeys, direction, moveKeys) {
      this.targetKeys = newTargetKeys
    },

    renderFormat (item) {
      var ops = {
        label: item.label,
        value: item.value,
      }
      return ops
    },

    handleSubmit () {
      this.$emit('chooseSubmit', this.targetKeys)
      this.cancel()
    }
  }
}
</script>

<style lang="less" scoped>
</style>
